<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/20
 * Time: 14:44
 */

namespace app\admin\controller;

use app\admin\Imp\ImpPlugins;

final class SystemController extends CommonController implements ImpPlugins
{
    public $is_verify = false;
    private static $config = [];
    private static $sort = 1;

    public static function setConfig()
    {
        self::$config = ['mySql版本:', '操作系统类型:', 'think5PHP版本:', '上传限制:', '服务器版本:', 'PHP版本:', 'php超时时间:'];
    }


    public static function controlAdmin()
    {
        self::setConfig();
        $path = pathinfo(get_class());
        $name = str_replace(config('controller_suffix'), '', $path['filename']);
        list($db_version) = db()->query('select version() as version');
        list($db_version) = array_values($db_version);
        $server_case = [
            $db_version,
            PHP_OS,
            THINK_VERSION,
            ini_get('upload_max_filesize'),
            $_SERVER['SERVER_SOFTWARE'],
            PHP_VERSION,
            ini_get('max_execution_time') . '秒',
        ];
        $case_data = [];
        $case_data['title'] = $name;
        $case_data['sort'] = self::$sort;
        foreach (self::$config as $key => $value) {
            $case_data ['list'][] = [$value, $server_case[$key]];
        }
        self::$config = $case_data;
    }


    public static function getUpdate()
    {
        self::controlAdmin();
        return self::$config;

    }


}